package com.doit.demo01;

import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.function.BiConsumer;

public class test_map_lambda {
    public static void main(String[] args) {
        Map<String,Integer> map = new TreeMap<>();
        map.put("史丹利",98 );
        map.put("尿素",18 );
        map.put("百草枯",38 );

        map.forEach(new BiConsumer<String, Integer>() {
            @Override
            public void accept(String s, Integer integer) {
                System.out.println(s+" "+integer);
            }
        });

        //加入lambda
        map.forEach((String key,Integer value)->{
            System.out.println(key+" "+value);
        });
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("嫩好");
            }
        }).start();
        new Thread(()->{
            while (true) {
                for (int i = 0; i < 10; i++) {
                    System.out.println(i);
                }
            }
        }).start();
    }
}
